<%-- 
    Document   : pesquisaPJRelatorio
    Created on : 24/07/2011, 15:11:25
    Author     : felipe
--%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="a4j" uri="https://ajax4jsf.dev.java.net/ajax"%>
<%@taglib prefix="r" uri="http://richfaces.org/rich"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Eventime - Sistema de Eventos</title>
        <script type="text/javascript" src="../../js/caixa.js"></script>
        <script type="text/javascript" src="../../js/mascaras.js"></script>
        <style type="text/css">
            @import url("../../css/style.css");
        </style>
    </head>
    <body>
        <f:view>
            <h:form>
        <div align="center">
            <table width="740" border="0" align="center">
                <tr>
                    <td width="740" height="30" background="/Eventime/jsp/imagens/barra-consulta-evento.jpg" class="style1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Consultar Pessoas Jurídicas</td>
                </tr>
                <tr class="style2">
                    <td><table width="730" border="0" align="center">
                            <tr>
                                <td height="32" colspan="4">
                                    <div align="center">
                                        <h:inputText id="busca" required="false" value="#{PessoaPJ.valorBusca}" styleClass="border" onkeyup="javascript:this.value=this.value.toUpperCase();" size="60"></h:inputText>&nbsp;
                                        <a4j:commandButton id="pesquisa" value="Pesquisar" styleClass="style2" action="#{PessoaPJ.pesquisaPJ}" reRender="scFisica,listaFisica"  />
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td height="32" colspan="6"><div align="center">
                                        <h:selectOneRadio id="tipoBusca" value="#{PessoaPJ.param}" styleClass="style2">
                                            <f:selectItem itemValue="cnpj" itemLabel="CNPJ"></f:selectItem>
                                            <f:selectItem itemValue="nome" itemLabel="Nome"></f:selectItem>
                                            <f:selectItem itemValue="Codigo" itemLabel="Codigo"></f:selectItem>
                                        </h:selectOneRadio></div></td>
                            </tr>
                            <tr>
                                <td colspan="4" align="center">
                                    <h:inputHidden id="flagPerfil" value="#{Login.usuarioEventoPerfil.perfil.codigo}"/>
                                    <r:messages styleClass="msg"/>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <r:datascroller id="scFisica" align="center" for="listaFisica" maxPages="20"/>
                                    <r:dataTable id="listaFisica" align="center" width="730" rows="7" value="#{PessoaPJ.listPessoaJuridica}" var="listJuridica" columnClasses="link" rowClasses="row, row2">
                                        <f:facet name="header">
                                            <r:columnGroup>
                                                <r:column width="50">
                                                    <h:outputText styleClass="headerText" value="Codigo" />
                                                </r:column>
                                                <r:column width="120">
                                                    <h:outputText styleClass="headerText" value="CNPJ" />
                                                </r:column>
                                                <r:column width="200">
                                                    <h:outputText styleClass="headerText" value="Nome Fantasia" />
                                                </r:column>
                                                <r:column width="200">
                                                    <h:outputText styleClass="headerText" value="Razão Social" />
                                                </r:column>
                                                <r:column width="100">
                                                    <h:outputText styleClass="headerText" value="Opções" />
                                                </r:column>
                                            </r:columnGroup>
                                        </f:facet>
                                        <r:column style="text-align:center">
                                            <h:outputText value="#{listJuridica.codigo}" />
                                        </r:column>
                                        <r:column style="text-align:center">
                                            <h:outputText value="#{listJuridica.cnpj}" />
                                        </r:column>
                                        <r:column style="text-align:center">
                                            <h:outputText value="#{listJuridica.nomeFantasia}" />
                                        </r:column>
                                        <r:column style="text-align:center">
                                            <h:outputText value="#{listJuridica.razaoSocial}" />
                                        </r:column>
                                        <r:column style="text-align:center">
                                            <h:commandButton  id="closePanel1"  image="/jsp/imagens/pessoas.png" action="#{RelatorioBean.gerarRelatorio}" alt="Incluir Pessoa Física" >
                                                <f:setPropertyActionListener value="#{listJuridica.codigo}" target="#{RelatorioBean.empresaCodigo}" />
                                                <f:setPropertyActionListener value="1" target="#{RelatorioBean.flag}" />
                                            </h:commandButton>
                                        </r:column>
                                    </r:dataTable>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
            </h:form>
        </f:view>
    </body>
</html>
